//package com.matt.foundation.ext.mq.impl;
//
//import com.aliyun.openservices.ons.api.Message;
//import com.matt.commons.exception.BusinessException;
//import com.matt.components.MQ.MQConfig;
//import com.matt.foundation.ext.mq.MQSender;
//import com.matt.foundation.model.ErrorCode;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.stereotype.Service;
//
//import java.io.UnsupportedEncodingException;
//
//
///**
// * *******************************
// * Created by Ron.
// * form com.matt
// * on 2018/10/24
// * *******************************
// */
//@Service
//@Slf4j
//public class MQSenderImpl implements MQSender {
//
//    @Value("${spring.profiles.active}")
//    private String env;
//
//    @Autowired
//    private MQConfig mqConfig;
//
//    @Override
//    public boolean sendMsg(String topic, String tag, String key, String content) {
//        try {
//            byte[] bytes = content.getBytes("utf-8");
//            Message msg = new Message(topic, tag, key, bytes);
//            mqConfig.producer().send(msg);
//        }catch (UnsupportedEncodingException e){
//            throw new BusinessException(ErrorCode.UNDEFINED, "字符编码不正确");
//        }
//
//        return true;
//    }
//}
